<?php
namespace Admin\Controller;

class SuserController extends AdminController
{
    public function index()
    {
        $nickname      = I('nickname');
        $map['status'] = array('egt', 0);
        if (is_numeric($nickname)) {
            $map['id|name'] = array(intval($nickname), array('like', '%' . $nickname . '%'), '_multi' => true);
        } else {
            $map['name'] = array('like', '%' . (string) $nickname . '%');
        }

        $list = $this->lists('suser', $map);
        int_to_string($list);
        $this->assign('_list', $list);
        $this->meta_title = '用户信息管理';
        $this->display();
    }

    public function update()
    {
    	$id = I('get.id');
    	$res = M('suser')->where(array('id'=>$id))->setField('active','0');
    	if($res){
    		$this->success('修改成功！');
    	}else{
    		$this->error(M('suser')->getError());
    	}
    }

    public function update1()
    {
    	$id = I('get.id');
    	$res = M('suser')->where(array('id'=>$id))->setField('active','1');
    	if($res){
    		$this->success('修改成功！');
    	}else{
    		$this->error(M('suser')->getError());
    	}
    }
}
